package cn.njupt;
import cn.njupt.cmpSort.*;
import cn.njupt.countSort.*;
import cn.njupt.utils.Asserts;
import cn.njupt.utils.Integers;

import java.util.Arrays;

public class Test<E extends Comparable<E>> {
    public void test(Sort<E>[] sorts, E[] array){
        for(Sort<E> sort:sorts){
            E[] newArray= Arrays.copyOf(array,array.length);
            sort.sort(newArray);
            Asserts.test(Integers.isAscOrder((Integer[]) newArray));
//            System.out.println(Arrays.toString(newArray));
        }
        Arrays.sort(sorts);
        for(Sort<E> sort:sorts){
            System.out.println(sort);
        }
    }

    public static void main(String[] args) {
        Integer[] arr1= Integers.random(100,0,100000);
        Double[] arr2={0.34,0.47,0.29,0.84,0.45,0.38,0.35,0.76};
        Test<Integer> test=new Test<>();
        test.test(new Sort[]{
//                new BubbleSort1<Integer>(),
//                new BubbleSort2<Integer>(),
//                new BubbleSort3<Integer>(),
//                new SelectionSort<Integer>(),
//                new HeapSort<Integer>(),
//                new InsertionSort1<Integer>(),
//                new InsertionSort2<Integer>(),
//                new InsertionSort3<Integer>(),
//                new MergeSort<Integer>(),
//                new QuickSort1<Integer>(),
//                new QuickSort2<Integer>(),
//                new ShellSort<Integer>(),
//                new CountingSort(),
//                new CountingSort2(),
                new RadixSort(),
                new RadixSort2(),
//                new BucketSort()
        },arr1);

    }
}
